#include "../../include/threadpool.h"

void ThreadPool::acc_thread(int fd, sockaddr_in &caddr, socklen_t &len, int epfd)
{
    // for (;;)
    // {
    //     if (accept_thread_list.size() != 0)
    //     {
    //         int cfd = accept(fd, (sockaddr *)&caddr, &len);
    //         cout << "!!!" << endl;
    //         string ip = inet_ntoa(caddr.sin_addr);
    //         struct epoll_event ev;
    //         ev.events = EPOLLIN;
    //         ev.data.fd = cfd;
    //         cout << "客户端接入" << endl;
    //         int temp = epoll_ctl(epfd, EPOLL_CTL_ADD, cfd, &ev);
    //     }
    // }
    int cfd = accept(fd, (sockaddr *)&caddr, &len);
    cout << "!!!" << endl;
    string ip = inet_ntoa(caddr.sin_addr);
    struct epoll_event ev;
    ev.events = EPOLLIN;
    ev.data.fd = cfd;
    cout << "客户端接入" << endl;
    int temp = epoll_ctl(epfd, EPOLL_CTL_ADD, cfd, &ev);
}